﻿using System;
namespace Erato_Prime
{
    class Prime
    {
        static List<int> Erato(List<int> list, List<int> result)
        {
            if (list.Count == 0) return result;
            List<int> newList = new List<int>();
            int div = list[0];
            result.Add(div);
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] % div != 0)
                    newList.Add(list[i]);
            }
            return Erato(newList, result);
        }
        static void Main(string[] args)
        {
            List<int> list = new List<int>();
            for (int i = 2; i < 10000000; i++)
            {
                list.Add(i);
            }
            List<int> primes = new List<int>();
            primes = Erato(list, primes);
            for (int i = 0; i < primes.Count; i++)
            {
                if (primes[i] != 0)
                    Console.WriteLine($"{primes[i]}");
            }
        }
    }
}